package com.richinfo.proxy.dynamic.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

import com.richinfo.proxy.demo.impl.RealSubject;

/**
 * Aspect
 * 
 * Created by WangXJ
 * 2019-07-04 11:14
 */
public class JdkProxySubject implements InvocationHandler{
	
	private RealSubject realSubject;

	public JdkProxySubject(RealSubject realSubject) {
		super();
		this.realSubject = realSubject;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("before .. jdk");
		Object result = null;
		// 反射获取对象
		result = method.invoke(realSubject, args);
		
		return result;
	}

}
